/**
 *
 *
 * @author TOTORO
 * @date 2021/8/9 19:41
 */
$(function () {
    // 点击撤销申请
    $(".largeMargin").click(function () {
        loading();
        setTimeout(v =>{
            $(".loading-box").remove();
            $(".mod-messagepc-mask").show();
            returnApplyDialog().appendTo("body");
            $("body").css({"overflow":"hidden", "padding-right":"16"});
        }, 400);
    });

    // 点击确定撤销
    $("body").on("click", ".confirm-revoke", function () {
        console.log(123)
        var returnId = $("#returnId").val();
        $.ajaxSettings.async = false;
        $.post("/dispute_logic/withdrawReturn.htm", {"bizReturnId": returnId}, function (res) {
            window.location.href = res;
        });
    });

    // 关闭消息提示
    $("body").on("click", ".closeIcon, .iNo", function () {
        $(".mod-messagepc-mask").hide();
        $(".messgaeDialog").remove();
        $("body").prop("style", "");
    });
})


/**
 * 生成确认撤销提示框
 * @returns {Window.jQuery|HTMLElement|*}
 */
function returnApplyDialog() {
    return $("<div class='messgaeDialog'>" +
        "<div>" +
        "<div class='mod-messagepc'><div class='content max-width undefined'>" +
        "<i class='closeIcon iconfont icon-close'></i>" +
        "<p1 class='title'><span></span>" +
        "</p1>" +
        "<span class='msg'>您将撤销本次申请，如果问题未解决，您还可以再次发起。确定继续吗？</span>" +
        "<div class='btn-placeholder '></div>" +
        "<div class='btn-area left'>" +
        "<div class='button-item highlight confirm-revoke' style='cursor:pointer;'>" +
        "<span>确定</span>" +
        "</div>" +
        "<div class='button-item ml iNo' style='cursor: pointer'>" +
        "<span>取消</span>" +
        "</div></div></div></div>" +
        "<div class='mod-messagepc-mask'></div></div></div>")
}

function loading() {
    var $loading = $("<div class='loading-box'>" +
        "<div class='mod-loading-layer show'>" +
        "<div class='layer'></div>" +
        "<div class='mui-loading-img mui-loading-play'></div></div></div>");
    $("body").append($loading);
}
